<template>
  <div class="container pos-rel">

  </div>
</template>

<script>
  import { setCategoryInfo } from '@/utils/auth'
  export default {
    components: {},
    data() {
      return {
        navList: []
      }
    },
    onLoad() {
      // 初始化data
      Object.assign(this.$data, this.$options.data())
    },
    onTabItemTap(item) {
      console.log(item.index)
      console.log(item)
      // this.$pt.getStorageSync('navList')
      this.navList = this.$pt.getStorageSync('navList')
      this.$pt.navigateTo({ url: '/' + this.navList[item.index].pagePath + this.navList[item.index].linkParams })
      // if (item.pagePath === 'pages/home/second-custom/main') {
      //   this.$pt.navigateTo({ url: this.navList[item.index].pagePath + this.navList[item.index].linkParams })
      // }
    },
    onUnload() {
      this.$pt.reLaunch({ url: '/pages/home/main' })
    },
    mounted() {
    },
    methods: {
      linkTo(item) {
        if (item.linkType) {
          if (item.linkStatus === 0) {
            this.$utils.showToast({title: '链接已失效'})
            return
          }
          if (Number(item.linkType) === 1002) return
          if (Number(item.linkType) === 1004) {
            this.$pt.removeStorageSync('categoryInfo')
            setCategoryInfo(this.$utils.getCaption(item.linkParams))
            this.$pt.switchTab({ url: this.linkList[item.linkType] })
            return
          }
          if (item.linkParams) {
            this.$pt.navigateTo({ url: this.linkList[item.linkType] + item.linkParams })
          } else {
            if (Number(item.linkType) === 1501 || Number(item.linkType) === 1502) {
              this.$pt.navigateTo({ url: this.linkList[item.linkType] + '?enterpriseId=' + this.enterpriceId + '&linkType=' + item.linkType })
            } else {
              this.$pt.navigateTo({ url: this.linkList[item.linkType] })
            }
          }
        }
      }
    }
  }
</script>

<style lang="less" scoped>
</style>
